package pl.example.domain;

import java.util.ArrayList;

import javax.persistence.Id;

import com.googlecode.objectify.Key;
import com.googlecode.objectify.annotation.Cached;

@Cached
public class Color {

	ArrayList<Key<Earing>> products = new ArrayList<Key<Earing>>();

	public void addEaring(Earing earing) {
		if (products == null) {
			products = new ArrayList<Key<Earing>>();
		}
		products.add(new Key<Earing>(earing.getClass(), earing.getId()));
	}

	@Override
	public String toString() {
		return new StringBuffer().append(id).append(" ").append(value)
				.append(" ").append(products).toString();
	}

	@Id
	public Long id;

	public Long getId() {
		return id;
	}

	public ArrayList<Key<Earing>> getProducts() {
		return products;
	}

	public void setId(Long id) {
		this.id = id;
	}

	String value;

	public Color() {
	}

	public Color(String value) {
		super();
		this.value = value;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}
}
